<template>
	<view class="record-list-wrapper">
		<view v-if="list.length">
			<view class="list-item" v-for="item in list" :key="item.id" @click="goInfo(item.id)">
				<view class="item-header">
					<view class="left">
						{{ types["整改状态"][item["整改状态"]] }}
					</view>
					<view class="right"> 整改日期：{{ item["整改开始日期"] }} </view>
				</view>
				<view class="item-content">
					<view class="detail">
						<view> 网格长：{{ item["网格长"] }} </view>
						<view> 网格员：{{ item["网格员"] }} </view>
						<view> 整改事项：{{ item["整改项"] }} </view>
						<view> 完成时间：{{ item["完成时间"] }} </view>
					</view>
					<!-- <view class="arrow"></view> -->
				</view>
			</view>
		</view>
		<view v-else>
			<van-empty description="暂无记录" />
		</view>
	</view>
</template>

<script>
	import dayjs from "dayjs";
	import vanEmpty from '@/wxcomponents/vant/dist/empty'
	export default {
		components: {
			vanEmpty
		},
		data() {
			return {
				types: this.$type,
				list: [],
			};
		},
		methods: {
			getRecordList(id, gridId) {
				let p = {
					检查点id: id,
					所属网格id: gridId,
				};
				console.log(p);
				this.$http.post("gridSystem/check/solveList", p).then((res) => {
					if (res.code === 10000) {
						console.log("res", res.data);
						if (res.data.list !== null) {
							res.data.list.forEach((item) => {
								item.整改开始日期 == '' ? item.整改开始日期 = '' : item.整改开始日期 = dayjs(item.整改开始日期).format("YYYY-MM-DD");
								item.完成时间 == '' ? item.完成时间 = '' : item.完成时间 = dayjs(item.完成时间).format("YYYY-MM-DD");
								item.整改项 == null ? item.整改项 = '' : item.整改项 = item.整改项.map(x => x.整改项描述).join(',');
							});
						}
						this.list = res.data.list || [];
					}
				});
			},
			goInfo(id) {
				uni.navigateTo({
					url: "/fireGridCheck/rectifyTaskDetail/rectifyTaskDetail?id=" + id,
				});
			},
		},
	};
</script>

<style lang="scss">
</style>
